package java44th.group.bean.admin.bo.topic;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Aurhor: 帅的一批
 * @CreateAt: 2022/10/13 14:16
 * @Description:
 * @PACKAGE_NAME： java44th.group.bean.admin.bo.topic
 */
@NoArgsConstructor
@AllArgsConstructor
@Data
public class TopicCreateBo {

    private Integer[] goods;
    private String title;
    private String subtitle;
    private String picUrl;
    private String content;
    private String price;
    private String readCount;

    //检查数据和合法性 价格和阅读量大于0
    public boolean checkDataValid() {
        try {
            if (getDoublePrice() < 0 ) {
                return false;
            }
            return true;
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
    }


    public Double getDoublePrice() {
        return Double.parseDouble(price);
    }


}
